//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
#if _MSC_VER > 1000
#pragma once
#endif

#if !defined(__CEVENT_H__)
#define __CEVENT_H__

class CEvent : public IEvent
{
// Interface functions
//
public:
    CARAPI_(PInterface) Probe(
        /* [in] */ REIID riid);

    CARAPI_(UInt32) AddRef(void);

    CARAPI_(UInt32) Release(void);

    CARAPI Aggregate(
        /* [in] */ AggrType aggrType,
        /* [in] */ PInterface pObject);

    CARAPI GetDomain(
        /* [out] */ PInterface *pObject);

    CARAPI Wait(
        /* [out] */ WaitResult *pResult,
        /* [out] */ EventState *pState);

    CARAPI TryWait(
        /* [in] */ Int32 msTimeout,
        /* [out] */ WaitResult *pResult,
        /* [out] */ EventState *pState);

    CARAPI Notify(EventState state);

    CARAPI Clear();

    CEvent(Boolean bManualReset, UInt32 dwInitialState) :
        m_kevent(bManualReset, dwInitialState)
    {
    }

    virtual ~CEvent() {}

    void NotifyByIsr(EventState State);

public:
    Interlocked m_cRef;
    DzEvent m_kevent;
};

#endif //!(__CEVENT_H__)
